]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st-widget: Move reactivity tracking to StWidget, use "insensitive"
authorJasper St. Pierre <jstpierre@mecheye.net>
Sun, 22 Jul 2012 23:46:48 +0000 (20:46 -0300)
committerJasper St. Pierre <jstpierre@mecheye.net>
Tue, 24 Jul 2012 09:11:21 +0000 (06:11 -0300)
This lets use remove another few pieces of code that do the tracking
manually.

https://bugzilla.gnome.org/show_bug.cgi?id=680426

data/theme/gnome-shell.css
js/ui/messageTray.js
js/ui/popupMenu.js
src/st/st-button.c
src/st/st-widget.c

index f2b5f3326770c7cc51c816891784bfb188e260d4..189b417d03a54cbdb973da5067c0234748042138 100644 (file)
@@ -202,7 +202,7 @@ StScrollBar StButton#vhandle:hover
     background-color: #4c4c4c;
 }
 
-.popup-menu-item:insensitive {
+StButton.popup-menu-item:insensitive {
     color: #9f9f9f;
 }
 
@@ -1630,7 +1630,7 @@ StScrollBar StButton#vhandle:hover
     padding: 4px 32px 5px;
 }
 
-.modal-dialog-button:disabled {
+.modal-dialog-button:insensitive {
     color: rgb(60, 60, 60);
 }
 
index d1c726de88035c8e74bd07d080695c25ccb8884a..d7b764742037bc3e72fc64ec0b6410c5bf6ae924 100644 (file)
@@ -799,10 +799,6 @@ const Notification = new Lang.Class({
             return;
 
         button.reactive = sensitive;
-        if (sensitive)
-            button.remove_style_pseudo_class('insensitive');
-        else
-            button.add_style_pseudo_class('insensitive');
     },
 
     setUrgency: function(urgency) {
index 7570d6ebcb5c857f6138a8ec459ce229b6a329f4..0517837d60d5eba796500b7e2a0a7ed4827413a2 100644 (file)
@@ -135,10 +135,6 @@ const PopupBaseMenuItem = new Lang.Class({
         this.sensitive = sensitive;
         this.actor.reactive = sensitive;
 
-        if (sensitive)
-            this.actor.remove_style_pseudo_class('insensitive');
-        else
-            this.actor.add_style_pseudo_class('insensitive');
         this.emit('sensitive-changed', sensitive);
     },
 
@@ -1900,10 +1896,6 @@ const RemoteMenu = new Lang.Class({
         }
 
         item.actor.reactive = action.enabled;
-        if (action.enabled)
-            item.actor.remove_style_pseudo_class('insensitive');
-        else
-            item.actor.add_style_pseudo_class('insensitive');
 
         destroyId = item.connect('destroy', Lang.bind(this, function() {
             item.disconnect(destroyId);
@@ -2036,11 +2028,6 @@ const RemoteMenu = new Lang.Class({
             for (let i = 0; i < action.items.length; i++) {
                 let item = action.items[i];
                 item.actor.reactive = action.enabled;
-
-                if (action.enabled)
-                    item.actor.remove_style_pseudo_class('insensitive');
-                else
-                    item.actor.add_style_pseudo_class('insensitive');
             }
         }
     }
index e3c46f9fb9e960fee1bccd0abec48f26efed5c05..a4edbe75a57d118b112f607091456876362e42d6 100644 (file)
@@ -446,15 +446,6 @@ st_button_class_init (StButtonClass *klass)
                   G_TYPE_INT);
 }
 
-static void
-notify_reactive_cb (StWidget *button)
-{
-  if (clutter_actor_get_reactive (CLUTTER_ACTOR (button)))
-    st_widget_remove_style_pseudo_class (button, "disabled");
-  else
-    st_widget_add_style_pseudo_class (button, "disabled");
-}
-
 static void
 st_button_init (StButton *button)
 {
@@ -464,9 +455,6 @@ st_button_init (StButton *button)
 
   clutter_actor_set_reactive (CLUTTER_ACTOR (button), TRUE);
   st_widget_set_track_hover (ST_WIDGET (button), TRUE);
-
-  g_signal_connect(button, "notify::reactive",
-                   G_CALLBACK (notify_reactive_cb), NULL);
 }
 
 /**
index 6d6539378a804ee26ebc374de03c09ad73a2b7d5..76780823915c48be78c7d38a61409339b475ab4d 100644 (file)
@@ -1404,6 +1404,17 @@ st_widget_name_notify (StWidget   *widget,
   st_widget_style_changed (widget);
 }
 
+static void
+st_widget_reactive_notify (StWidget   *widget,
+                           GParamSpec *pspec,
+                           gpointer    data)
+{
+  if (clutter_actor_get_reactive (CLUTTER_ACTOR (widget)))
+    st_widget_remove_style_pseudo_class (widget, "insensitive");
+  else
+    st_widget_add_style_pseudo_class (widget, "insensitive");
+}
+
 static void
 st_widget_first_child_notify (StWidget   *widget,
                               GParamSpec *pspec,
@@ -1466,6 +1477,7 @@ st_widget_init (StWidget *actor)
 
   /* connect style changed */
   g_signal_connect (actor, "notify::name", G_CALLBACK (st_widget_name_notify), NULL);
+  g_signal_connect (actor, "notify::reactive", G_CALLBACK (st_widget_reactive_notify), NULL);
 
   g_signal_connect (actor, "notify::first-child", G_CALLBACK (st_widget_first_child_notify), NULL);
   g_signal_connect (actor, "notify::last-child", G_CALLBACK (st_widget_last_child_notify), NULL);